Butterworth lowpass filter, page 273.

$ H(u,v) = \frac{1}{1+[D(u,v)/D_0]^{2n}} $


In [1]:
%run ../common.ipynb
image = imread('../MP.tiff')
F = fft2(image)


Populating the interactive namespace from numpy and matplotlib

In [4]:
n = 2
D = 100
y,x = F.shape
X,Y = meshgrid(range(x), range(y))
H = 1/(1 + (sqrt((X-x/2)**2 + (Y-y/2)**2)/D)**(2*n))
gimshow(H)



In [6]:
G = fftshift(F)*H
G = ifftshift(G)
g = ifft2(G).real
gimshow(g)



In [8]:
imsave('lp-butterworth.tif', g.astype(np.uint8))